package imnu.th.join;

/**
 * @author: lys
 * @类名: MyThread01
 * @Title:
 * @date: 2020/7/22
 **/
public class MyThread01 extends Thread {
    private MyThread02 th2;
    @Override
    public void run() {
        for (int i=0;i<10;i++){
            try {
                Thread.sleep(300);
                if (i==5){
                    th2.join();
                }
                System.out.println("黑龙"+i);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public MyThread02 getTh2() {
        return th2;
    }

    public void setTh2(MyThread02 th2) {
        this.th2 = th2;
    }
}
